package com.junzhiit.nengji.cms.web.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.bainaeco.framework.util.AssertUtil;
import com.junzhiit.nengji.cms.service.ShopLocatedService;
import com.junzhiit.nengji.cms.web.vo.DataTablesParamVO;
import com.junzhiit.nengji.cms.web.vo.ResultVO;
import com.junzhiit.nengji.cms.web.vo.ShopLocatedVO;

import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("/shop/located")
public class ShopLocatedContoller extends BaseController {
	
	@Autowired
	private ShopLocatedService shopLocatedService;
	
	@ApiOperation(value = "取得所有入驻信息")
	@RequestMapping(method = RequestMethod.GET)
	public Map<String, Object> findAll(DataTablesParamVO dtp, ShopLocatedVO shopLocatedVO) {
		return shopLocatedService.findAll(dtp, shopLocatedVO);
	}
	
	@ApiOperation(value = "根据ID查询入驻信息")
	@RequestMapping(value = "/info/{id}", method = RequestMethod.GET)
	public ResultVO getShopById(@PathVariable String id) {
		AssertUtil.notBlank(id, "id is required.");
		return shopLocatedService.fingShopsLocatedById(id);
	}
	
	@ApiOperation(value = "更新入驻信息")
	@RequestMapping( method = RequestMethod.PUT)
	public ResultVO updatedById(ShopLocatedVO shopLocatedVO) {
		return shopLocatedService.updatedById(shopLocatedVO);
	}
}
